home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / gnuplot-3.7src.lha / gnuplot-3.7src / gnuplot-3.7.lha / gnuplot-3.7 / ctrl87.h < prev    next >
C/C++ Source or Header  |  1998-04-15  |  5KB  |  149 lines

  1. /* $Id: ctrl87.h,v 1.2 1998/03/22 22:31:27 drd Exp $ */
  2.  
  3. /* GNUPLOT - ctrl87.h */
  4.  
  5. /*[
  6.  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
  7.  *
  8.  * Permission to use, copy, and distribute this software and its
  9.  * documentation for any purpose with or without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and
  11.  * that both that copyright notice and this permission notice appear
  12.  * in supporting documentation.
  13.  *
  14.  * Permission to modify the software is granted, but not the right to
  15.  * distribute the complete modified source code.  Modifications are to
  16.  * be distributed as patches to the released version.  Permission to
  17.  * distribute binaries produced by compiling modified sources is granted,
  18.  * provided you
  19.  *   1. distribute the corresponding source modifications from the
  20.  *    released version in the form of a patch file along with the binaries,
  21.  *   2. add special version identification to distinguish your version
  22.  *    in addition to the base release version number,
  23.  *   3. provide your name and address as the primary contact for the
  24.  *    support of your modified version, and
  25.  *   4. retain our contact information in regard to use of the base
  26.  *    software.
  27.  * Permission to distribute the released version of the source code along
  28.  * with corresponding source modifications in the form of a patch file is
  29.  * granted with same provisions 2 through 4 for binary distributions.
  30.  *
  31.  * This software is provided "as is" without express or implied warranty
  32.  * to the extent permitted by applicable law.
  33. ]*/
  34.  
  35.  
  36. #ifndef __CONTROL87_H__
  37.  
  38.  
  39. #define __CONTROL87_H__
  40.  
  41.  
  42. #ifdef __CONTROL87_C__
  43. #define EXTERN
  44. #else
  45. #define EXTERN extern
  46. #endif
  47.  
  48.  
  49. /* 8087/80287 Status Word format   */
  50.  
  51. #define SW_INVALID      0x0001  /* Invalid operation            */
  52. #define SW_DENORMAL     0x0002  /* Denormalized operand         */
  53. #define SW_ZERODIVIDE   0x0004  /* Zero divide                  */
  54. #define SW_OVERFLOW     0x0008  /* Overflow                     */
  55. #define SW_UNDERFLOW    0x0010  /* Underflow                    */
  56. #define SW_INEXACT      0x0020  /* Precision (Inexact result)   */
  57.  
  58. /* 8087/80287 Control Word format */
  59.  
  60. #define MCW_EM              0x003f  /* interrupt Exception Masks*/
  61. #define     EM_INVALID      0x0001  /*   invalid                */
  62. #define     EM_DENORMAL     0x0002  /*   denormal               */
  63. #define     EM_ZERODIVIDE   0x0004  /*   zero divide            */
  64. #define     EM_OVERFLOW     0x0008  /*   overflow               */
  65. #define     EM_UNDERFLOW    0x0010  /*   underflow              */
  66. #define     EM_INEXACT      0x0020  /*   inexact (precision)    */
  67.  
  68. #define MCW_IC              0x1000  /* Infinity Control */
  69. #define     IC_AFFINE       0x1000  /*   affine         */
  70. #define     IC_PROJECTIVE   0x0000  /*   projective     */
  71.  
  72. #define MCW_RC          0x0c00  /* Rounding Control     */
  73. #define     RC_CHOP     0x0c00  /*   chop               */
  74. #define     RC_UP       0x0800  /*   up                 */
  75. #define     RC_DOWN     0x0400  /*   down               */
  76. #define     RC_NEAR     0x0000  /*   near               */
  77.  
  78. #define MCW_PC          0x0300  /* Precision Control    */
  79. #define     PC_24       0x0000  /*    24 bits           */
  80. #define     PC_53       0x0200  /*    53 bits           */
  81. #define     PC_64       0x0300  /*    64 bits           */
  82.  
  83. /**************************************************************************/
  84. /*************************   Type declarations   **************************/
  85. /**************************************************************************/
  86.  
  87. /**************************************************************************/
  88. /************************   Function declarations   ***********************/
  89. /**************************************************************************/
  90.  
  91. /*
  92.    _control87 changes floating-point control word.
  93.  
  94.    Declaration:
  95.    ------------
  96.      unsigned short _control87(unsigned short newcw, unsigned short mask);
  97.  
  98.    Remarks:
  99.    --------
  100.   _control87 retrieves or changes the floating-point control word.
  101.  
  102.   The floating-point control word is an unsigned short that specifies the
  103.   following modes in the 80x87 FPU:
  104.    o  allowed exceptions
  105.    o  infinity mode
  106.    o  rounding mode
  107.    o  precision mode
  108.  
  109.   Changing these modes allows you to mask or unmask floating-point exceptions.
  110.  
  111.   _control87 matches the bits in mask to the bits in newcw.
  112.  
  113.   If any mask bit = 1, the corresponding bit in newcw contains the new value
  114.   for the same bit in the floating-point control word.
  115.  
  116.   If mask = 0000, _control87 returns the floating-point control word without
  117.   altering it.
  118.  
  119.    Examples:
  120.    ---------
  121.   Switching to projective infinity mode:
  122.      _control87(IC_PROJECTIVE, MCW_IC);
  123.  
  124.   Disabling all exceptions:
  125.      _control87(MCW_EM, MCW_EM);
  126.  
  127.    Return Value:
  128.    -------------
  129.   The bits in the value returned reflect the new floating-point control word.
  130. */
  131. EXTERN unsigned short _control87(unsigned short newcw, unsigned short mask);
  132.  
  133.  
  134. /**************************************************************************/
  135. /**************************   Global variables   **************************/
  136. /**************************************************************************/
  137.  
  138.  
  139.  
  140. #ifdef __CONTROL87_C__
  141. #else
  142. #endif
  143.  
  144.  
  145. #undef EXTERN
  146.  
  147.  
  148. #endif
  149.